package com.zwan.oam_rtc.utils.messages;

import com.zwan.oam_rtc.utils.wintcp.ByteTransfer;

import java.nio.ByteBuffer;

/***
 * 回调结果消息  
 * callflowId
 * callbackUrl
 * callstatus
 * @author 
 *
 */

public class SDFAckMessage extends AbstractStruct {

    private byte[] DlgNumber = new byte[4];
    private byte DBNo ;
    private byte SQLResultID ;
    private byte[] TurnOver = new byte[4];
    private byte[] SQLResult = new byte[1024*5+1];



    private static int LENGTH = 1024*5+1+10;
    
    /**
     * 返回消息写入buffer
     */
    @Override
    public void writeToBuffer(ByteBuffer bf) {
        bf.put(DlgNumber);
        bf.put(DBNo);
        bf.put(SQLResultID);
        bf.put(TurnOver);
        bf.put(SQLResult);
    }

    /**
     * buffer读出返回消息
     */
    @Override
    public void readFromBuffer(ByteBuffer bf) {
        bf.get(DlgNumber);
        bf.get(DBNo);
        bf.get(SQLResultID);
        bf.get(TurnOver);
        bf.get(SQLResult);
    }

    public void setDlgNumber(byte[] dlgNumber) {
        System.arraycopy(dlgNumber,0,this.DlgNumber,0,4);
    }

    public void setDBNo(byte DBNo) {
        this.DBNo = DBNo;
    }

    public void setSQLResultID(byte SQLResultID) {
        this.SQLResultID = SQLResultID;
    }

    public void setTurnOver(byte[] turnOver) {
        System.arraycopy(turnOver,0,this.TurnOver,0,4);
    }

    public void setSQLResult(String SQLResult) {
        ByteTransfer.str2Byte(SQLResult, this.SQLResult);
        //this.dlgID = bf.order(ByteOrder.LITTLE_ENDIAN).getShort();
    }

    @Override
    public int getLength() {
        return LENGTH;
    }



}
